package pages 

import (
	"github.com/templui/templui/internal/ui/layouts"
	"github.com/templui/templui/internal/ui/modules"
	"github.com/templui/templui/internal/ui/showcase"
)

templ Sheet() {
	@layouts.DocsLayout(
		"Sheet",
		"Extends the Dialog component to display content that complements the main content of the screen.",
		[]modules.TableOfContentsItem{
			{
				ID:   "installation",
				Text: "Installation",
			},
			{
				ID:   "examples",
				Text: "Examples",
				Children: []modules.TableOfContentsItem{
					{
						ID:   "sheet-sides",
						Text: "Sheet Sides",
					},
					{
						ID:   "external-trigger",
						Text: "External Trigger",
					},
					{
						ID:   "standalone-content",
						Text: "Standalone Content",
					},
				},
			},
			{
				ID:   "api-reference",
				Text: "API Reference",
				Children: []modules.TableOfContentsItem{
					{
						ID:   "sheet",
						Text: "Sheet",
					},
					{
						ID:   "trigger",
						Text: "Trigger",
					},
					{
						ID:   "content",
						Text: "Content",
					},
					{
						ID:   "header",
						Text: "Header",
					},
					{
						ID:   "title",
						Text: "Title",
					},
					{
						ID:   "description",
						Text: "Description",
					},
					{
						ID:   "footer",
						Text: "Footer",
					},
					{
						ID:   "close",
						Text: "Close",
					},
				},
			},
		},
	) {
		@modules.PageWrapper(modules.PageWrapperProps{
			Name:        "Sheet",
			Description: templ.Raw("Extends the <a href=\"/docs/components/dialog\" class=\"text-primary underline underline-offset-2 hover:opacity-80 transition-opacity\">Dialog</a> component to display content that complements the main content of the screen."),
			Tailwind:    true,
			VanillaJS:   true,
			Breadcrumbs: modules.Breadcrumbs{
				Items: []modules.BreadcrumbItem{
					{
						Text: "Docs",
						Path: "/docs",
					},
					{
						Text: "Components",
						Path: "/docs/components",
					},
					{
						Text: "Sheet",
					},
				},
			},
		}) {
			@modules.ExampleWrapper(modules.ExampleWrapperProps{
				ShowcaseFile:    showcase.SheetDefault(),
				PreviewCodeFile: "sheet_default.templ",
			})
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "Examples",
				ID:    "examples",
			}) {
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "Sheet Sides",
					ShowcaseFile:    showcase.SheetSides(),
					PreviewCodeFile: "sheet_sides.templ",
					ID:              "sheet-sides",
				})
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "External Trigger",
					ShowcaseFile:    showcase.SheetExternalTrigger(),
					PreviewCodeFile: "sheet_external_trigger.templ",
					ID:              "external-trigger",
				})
				@modules.ExampleWrapper(modules.ExampleWrapperProps{
					SectionName:     "Standalone Content",
					ShowcaseFile:    showcase.SheetStandalone(),
					PreviewCodeFile: "sheet_standalone.templ",
					ID:              "standalone-content",
				})
			}
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "Installation",
				ID:    "installation",
			}) {
				@modules.ComponentUsage(modules.ComponentUsageProps{
					ComponentName: "sheet",
					JSFiles:       []string{"dialog"},
				})
			}
			@modules.ContainerWrapper(modules.ContainerWrapperProps{
				Title: "API Reference",
				ID:    "api-reference",
			}) {
				@modules.APILegend()
				<div id="sheet" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Sheet",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "randomID",
								Description: "Unique identifier for the sheet (auto-generated if not provided)",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the sheet wrapper",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the sheet wrapper",
							},
							{
								Name:        "Side",
								Type:        "Side",
								Default:     "SideRight",
								Description: "Side from which the sheet slides in (top, right, bottom, left)",
							},
							{
								Name:        "Open",
								Type:        "bool",
								Default:     "false",
								Description: "Whether the sheet should be open initially",
							},
							{
								Name:        "DisableClickAway",
								Type:        "bool",
								Default:     "false",
								Description: "Disable closing the sheet when clicking the backdrop",
							},
							{
								Name:        "DisableESC",
								Type:        "bool",
								Default:     "false",
								Description: "Disable closing the sheet with the ESC key",
							},
						},
					})
				</div>
				<div id="trigger" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Trigger",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the trigger element",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the trigger",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the trigger",
							},
							{
								Name:        "For",
								Type:        "string",
								Default:     "\"\"",
								Description: "ID of the sheet to trigger (for external triggers outside Sheet wrapper)",
							},
						},
					})
				</div>
				<div id="content" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Content",
						Items: []modules.APITableItem{
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the content container",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the content container",
							},
							{
								Name:        "HideCloseButton",
								Type:        "bool",
								Default:     "false",
								Description: "Hide the close X button in the top right corner",
							},
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Sheet ID for standalone usage (when not wrapped in Sheet component)",
							},
							{
								Name:        "Side",
								Type:        "Side",
								Default:     "SideRight",
								Description: "Side for standalone usage (when not wrapped in Sheet component)",
							},
							{
								Name:        "Open",
								Type:        "bool",
								Default:     "false",
								Description: "Initial open state for standalone usage (when not wrapped in Sheet component)",
							},
						},
					})
				</div>
				<div id="header" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Header",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the header element",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the header",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the header",
							},
						},
					})
				</div>
				<div id="title" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Title",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the title element",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the title",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the title",
							},
						},
					})
				</div>
				<div id="description" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Description",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the description element",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the description",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the description",
							},
						},
					})
				</div>
				<div id="footer" class="mb-8">
					@modules.APITable(modules.APITableProps{
						Title: "Footer",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the footer element",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the footer",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the footer",
							},
						},
					})
				</div>
				<div id="close">
					@modules.APITable(modules.APITableProps{
						Title: "Close",
						Items: []modules.APITableItem{
							{
								Name:        "ID",
								Type:        "string",
								Default:     "\"\"",
								Description: "Unique identifier for the close button",
							},
							{
								Name:        "Class",
								Type:        "string",
								Default:     "\"\"",
								Description: "Additional CSS classes to apply to the close button",
							},
							{
								Name:        "Attributes",
								Type:        "templ.Attributes",
								Default:     "nil",
								Description: "Additional HTML attributes to apply to the close button",
							},
						},
					})
				</div>
			}
		}
	}
}
